<?php

namespace App\Http\Controllers\Api\V1;

use App\Models\BankCard;
use App\Http\Controllers\Api\V1\Requests\BankCardRequest;
use App\Http\Controllers\Api\V1\Resources\BankCardResource;

class BankCardsController extends Controller
{
	public function store(BankCardRequest $request)
    {
        $bank_card = $request->user()->addBnakCard();
        return new BankCardResource($bank_card);
    }

    public function index()
    {
        $bank_card = request()->user();
        return new BankCardResource($bank_card);
    }

    public function destroy(){

        $bank_card = request()->user();
        $bank_card->update([
            'real_name' => null,
            'cert_number' => null,
            'bank_name' => null,
            'bank_abbr' => null
        ]);

        return response(null, 204);

    }
}
